-
Notifications
You must be signed in to change notification settings - Fork 41
MaxContentLength modification at runtime #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alor
wants to merge
14
commits into
eventmachine:master
Choose a base branch
from
alor:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
any comments on it ? thank you. |
…ector
Currently, if a class overrides the 'unbind' method, the RubyHttpConnection
object in each connection object will be leaked. Similarly, if no one ever
calls 'unbind' on the HttpServer, the RubyHttpConnection will be leaked on
garbage collection. For example, the following program has a memory leak:
"""
require 'rubygems'; require 'eventmachine'; require 'evma_httpserver'
class MyServer < EM::Connection
include EM::HttpServer
def unbind; end
end
EM.run do
EM.start_server '127.0.0.1', 9000, MyServer
end
"""
As does the following:
"""
require 'rubygems'; require 'eventmachine'; require 'evma_httpserver'
class MyServer < EM::Connection
include EM::HttpServer
end
10000.times { MyServer.new 1 }
"""
This patch moves destruction of the RubyHttpConnection object from the unbind
method to the garbage collector.
One may wonder about the performance implications of this patch. As a rough
estimate, on my quad-core/16 GB RAM desktop, I ran
time for i in $(seq 1 10000); do curl localhost:9000; done
with and without this patch against the following server program:
"""
require 'rubygems'; require 'eventmachine'; require 'evma_httpserver'
class MyServer < EM::Connection; include EM::HttpServer; end
EM.run { EM.start_server '0.0.0.0', 9000, MyServer }
"""
Results are shown below.
[Without this patch (8e20269)]
$ time ( for i in $(seq 1 10000); do curl 127.0.0.1:9000; done >/dev/null 2>/dev/null )
real 0m57.654s
user 0m2.770s
sys 0m3.230s
[With this patch]
$ time ( for i in $(seq 1 10000); do curl 127.0.0.1:9000; done >/dev/null 2>/dev/null )
real 0m55.123s
user 0m2.550s
sys 0m3.240s
A 404/201 response does not indicate that the connection is unviable.
Added support for absolute URIs on request line
Bundler e gemspec
added OPTIONS to list of verbs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
i've added the bindings to change the max length of a post request at runtime.
i've also inserted the ability to specify the HTTP status code description in responses.
if you like it, merge it and publish a new gem version.
thank you.